package com.woohua.demo.service;

import cn.hutool.core.util.RandomUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woohua.demo.domain.Order;
import com.woohua.demo.mapper.OrderMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.UUID;

/***
 * @title OrderService
 * @description
 * @author baiji
 * @version 1.0.0
 * @create 2023/11/14 15:56
 **/
@Slf4j
@Service
public class OrderService extends ServiceImpl<OrderMapper, Order> {


    public void add() {
        Order order = new Order();
        order.setOrderNo("WH-" + UUID.randomUUID());
        order.setOrderType(RandomUtil.randomInt(0, 10));
        order.setUserId(Math.abs(RandomUtil.randomLong()));

        log.info("1.添加对象的数据： {}", order);
        save(order);
        log.info("2.添加成功");
    }
}
